home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / programr / tkern10.zip / INCLUDE\SYS\TFILE.H < prev    next >
Text File  |  1994-05-14  |  3KB  |  109 lines

  1. /*
  2.  *  This file forms part of "TKERN" - "Troy's Kernel for Windows".
  3.  *
  4.  *  Copyright (C) 1994  Troy Rollo <troy@cbme.unsw.EDU.AU>
  5.  *
  6.  *  This library is free software; you can redistribute it and/or
  7.  *  modify it under the terms of the GNU Library General Public
  8.  *  License as published by the Free Software Foundation; either
  9.  *  version 2 of the License, or (at your option) any later version.
  10.  *
  11.  *  This library is distributed in the hope that it will be useful,
  12.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14.  *  Library General Public License for more details.
  15.  *
  16.  *  You should have received a copy of the GNU Library General Public
  17.  *  License along with this library; if not, write to the Free
  18.  *  Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  */
  20.  
  21. /* tfile.h - definition of the tsh file structure */
  22.  
  23. #ifndef __tfile__h
  24. #define    __tfile__h
  25.  
  26. #ifndef    __device_t
  27. #include <sys/tdevice.h>
  28. #endif
  29.  
  30. /* This file is only useful to TKERN and TKFMANGR, so we don't
  31.  * bother with __TKPROTO
  32.  */
  33.  
  34. /* The tfile structure contains the per open file information for all of tkern */
  35. struct    tfile
  36. {
  37.     int    tf_id;        /* the file id                */
  38.     int    tf_cnt;        /* The reference count            */
  39.     int    tf_dev;        /* The device number            */
  40.     int    tf_eof;        /* EOF seen by TKERN but not by program    */
  41. };
  42.  
  43. /*
  44.  * tk_ioctl is the structure containing ioctl stuff for TKFMANGR
  45.  */
  46. #define    _TKIO_MAXBUF    256
  47. struct    tk_ioctl
  48. {
  49.     long    nIOCtl;
  50.     char    achBuffer[_TKIO_MAXBUF];
  51.     int    nSize;
  52. };
  53.  
  54. /* tfunc contains information used by file functions. This works by sending a message
  55.  * to the tkern file manager such as:
  56.  *
  57.  * SendMessage(hManagerWindow, TKWM_function, tf_id, tfunc_info)
  58.  *
  59.  * TKWM_function is one of the TKWM_ constants defined in this file.
  60.  * tf_id is from the tfile entry.
  61.  * tfunc_info is the address of a tfunc structure, which must have been allocated as
  62.  * a DDESHARE chunk of memory.
  63.  * Note that we declare buffers in tfunc rather than pointers into the
  64.  * original executable because we can't guarantee that TKFMANGR can
  65.  * always read the original memory locations in all implimentations of
  66.  * Win16.
  67.  */
  68.  
  69. #define    _FNLEN    256
  70. #define    _FBUFSZ    1024
  71.  
  72. struct    tfunc
  73. {
  74.     int    iDevice;        /* Device number    */
  75.     char    achFile[_FNLEN];    /* Open, GetDevNo    */
  76.     char    achBuffer[_FBUFSZ];    /* Read, Write        */
  77.     int    nBytes;            /* Read, Write        */
  78.     long    nPosition;        /* Seek            */
  79.     int    nFrom;            /* Seek            */
  80.     int    nMode;            /* Open            */
  81.     int    nAccess;        /* Open            */
  82.     int    iTask;            /* The task index    */
  83.     struct tk_ioctl tki;        /* Ioctl information    */
  84. };
  85.  
  86. #define    TKWM_OPEN    (WM_USER + 1)
  87. #define    TKWM_CLOSE    (WM_USER + 2)
  88. #define TKWM_IOCTL    (WM_USER + 3)
  89. #define    TKWM_READ    (WM_USER + 4)
  90. #define    TKWM_WRITE    (WM_USER + 5)
  91. #define    TKWM_SEEK    (WM_USER + 6)
  92. #define    TKWM_GETDEVNO    (WM_USER + 7)
  93. #define    TKWM_ISATTY    (WM_USER + 8)
  94. #define    TKWM_ALLDONE    (WM_USER + 9)
  95.  
  96. #define    TNFILE    50
  97.  
  98. /* File error return codes. Only -1 should get back to the user
  99.  * program
  100.  */
  101.  
  102. #define    FR_ERROR    -1    /* Genuine error - fail        */
  103. #define    FR_NOTREADY    -2    /* Flush messsages and retry    */
  104.  
  105.  
  106. int    get_device_number(char const *pchName);
  107.  
  108. #endif
  109.